home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.1 / card_6103.txt < prev    next >
Text File  |  1989-02-26  |  3KB  |  155 lines

  1. -- card: 6103 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 2612
  5. -- name: SoundCapToRes
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: A003
  11. -- rect: left=82 top=302 right=324 bottom=182
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Install
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   if the optionkey is down then pass mouseup
  23.   put installres(XCMD,SoundCapToRes) into it
  24.   if it is empty then play boing
  25.   else answer it
  26. end mouseUp
  27.  
  28.  
  29.  
  30. -- part 2 (button)
  31. -- low flags: 00
  32. -- high flags: A003
  33. -- rect: left=163 top=265 right=290 bottom=282
  34. -- title width / last selected line: 0
  35. -- icon id / first selected line: 0 / 0
  36. -- text alignment: 1
  37. -- font id: 0
  38. -- text size: 12
  39. -- style flags: 0
  40. -- line height: 16
  41. -- part name: Convert Sounds
  42. ----- HyperTalk script -----
  43. on mouseUp
  44.   if the optionkey is down then pass mouseup
  45.  
  46.   put "This lets you convert soundcap or soundwave sounds and install them."
  47.  
  48.   -- get the name of the original sound file
  49.   answer "You may now select the sound file" with "Cancel" or "OK"
  50.   if it = "Cancel" then
  51.     play oops
  52.     hide message window
  53.     exit mouseup
  54.   end if
  55.  
  56.   put filename(FSSD) into SoundName
  57.   if SoundName is empty then
  58.     hide message window
  59.     play oops
  60.     exit mouseup
  61.   end if
  62.   put quote&SoundName"e into SoundName
  63.  
  64.   -- get the sampling rate (between 1 and 4)
  65.   ask "What sample rate should be used? (1,2,3 or 4)" with "2"
  66.   if it <1 or it >4 then
  67.     play oops
  68.     hide message window
  69.     exit mouseup
  70.   end if
  71.  
  72.   if it =1 then put 60 into it else
  73.   if it =2 then put 72 into it else
  74.   if it =3 then put 79 into it else put 84 into it
  75. end if
  76. end if
  77. put it into SampleRate
  78.  
  79. -- let user name the sound resource
  80. ask "What do you want to name this sound?"
  81. if it is empty then
  82.   play oops
  83.   hide message window
  84.   exit mouseup
  85. end if
  86. put it into ResName
  87.  
  88. -- get the name of the destination stack
  89. put "Please select the destination stack"
  90. put filename ("STAK") into Destination
  91. if Destination is empty then
  92.   hide message window
  93.   play oops
  94.   exit mouseup
  95. end if
  96. put quote&Destination"e into Destination
  97.  
  98. -- do the conversion using the XCMD 'SoundCaptoRes'
  99.  
  100. -- SoundCapToRes takes four arguments:
  101. -- the name you want to call the sound
  102. -- the file that contains the SoundCap output (in quotes)
  103. -- the stack in which you want to put the sound
  104. -- the base pitch of the sound (60, 72, 79, or 84)
  105.  
  106. put ResName into Args
  107. put ","&SoundName after Args
  108. put ","&Destination after Args
  109. put ","&SampleRate after Args
  110.  
  111. do "SoundCaptoRes" && Args
  112.  
  113. -- go to the target stack and test the sound
  114. push card
  115. go to Destination
  116. play ResName
  117. repeat while the sound is not "done"
  118. end repeat
  119. pop card
  120. end mouseUp
  121.  
  122.  
  123.  
  124. -- part contents for background part 13
  125. ----- text -----
  126. 5
  127.  
  128. -- part contents for background part 2
  129. ----- text -----
  130. SoundCapToRes
  131.  
  132. -- part contents for background part 3
  133. ----- text -----
  134.  
  135. This will convert a SoundCap or SoundWave file into a 
  136. 'snd' resource and install it into a specified stack.
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144. Thanks to:
  145. ? (If anyone knows who wrote this please pass the information on so proper credit can be given.)
  146.  
  147.  
  148.  
  149. -- part contents for background part 10
  150. ----- text -----
  151. Syntax:
  152.  
  153. SoundCapToRes <ResourceName>,
  154. <SourceFile>,<DestinationFile>,
  155. <SampleRate>